<template>
	<view>
		<view class="imgvideo">
			<text :class="{video_title : isimg}" @click="totaggle(0)">采购入库</text>
			<text :class="{video_title : !isimg}" @click="totaggle(2)">归还入库</text>
		</view>
		<view class="list_content">
			
			<view class="con_list u-border-bottom u-rela" v-for="(item,index) in list" :key="index" @click="toinDetail(item)">
				<view style="color:#008987;font-size: 26rpx;" class="u-abso pos_right">{{item.nav}}</view>
				<!-- <view v-else style="color:#ff5500;font-size: 26rpx;" class="u-abso pos_right">采购中</view> -->
				<image :src="item.image" mode="aspectFill"></image>
				<view class="dis_inl_blo con_intro">
					<view class="title_name">{{item.name}}</view>
					<view class="person_con">
						￥：<text>{{item.unit}}</text>
						<image class="va_m" style="width:25rpx;height:25rpx;margin-left:20rpx;" src="../../static/num.png"></image>
						
						<text class="u-margin-left-10">:{{item.num}}</text>
					</view>
					<view class="price u-abso">
						<text>总价：{{item.price}}</text>
						<text class="time u-abso pos_right">{{$u.timeFormat(item.update_time, 'yyyy-mm-dd')}}</text>
						
					</view>
				</view>
			</view>
		</view>
		<u-empty :show="showEmpty" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
		</u-empty>
	</view>
</template>

<script>
	import {
		getAssetsInOutLog
	} from "@/service/assetService.js";
	export default {
		data () {
			return {
				showEmpty:false,
				list:[],
				isimg:true,
			}
		},
		onLoad() {
			getAssetsInOutLog({type:0}).then(this.getAssetsInOutLog)
		},
		methods:{
			getAssetsInOutLog(e){
				if(e.code==200){
					this.list=e.result;
					this.showEmpty=false
				}else{
					this.list=[];
					this.showEmpty=true
				}
			},
			totaggle:function(num){
				var that=this;
				if(num==0){
					this.isimg=true;
					getAssetsInOutLog({type:num}).then(this.getAssetsInOutLog)
				}else{
					this.isimg=false;
					this.list=[];
					getAssetsInOutLog({type:num}).then(res=>{
						if(res.code==200){
							
							for(var i=0;i<res.result.length;i++){
								if(res.result[i].revert==1){
									that.list.push(res.result[i])
									that.showEmpty=false
								}else{
									that.showEmpty=true
								}
								
							}
						}else{
							this.list=[];
							this.showEmpty=true
						}
						
					})
				}
				
			},
			toinDetail(item){
				uni.navigateTo({
					url:'./inDetail?item='+encodeURIComponent(JSON.stringify(item))
					// url:'./inDetail?id='+id
				})
			},
			// toadd(){
			// 	uni.navigateTo({
			// 		url:'./addStore'
			// 	})
			// }
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f5f5f5;
	}
	.imgvideo{
		display: block;
		width:95%;
		margin:30rpx auto;
		border:1rpx solid #008987;
		border-radius: 10rpx;
		overflow: hidden;
		text{
			display: inline-block;
			height:60rpx;
			width:50%;
			color:#008987;
			text-align: center;
			line-height: 60rpx;
		}
		.video_title{
			color:#fff;
			background-color: #008987;
		}
	}
	.tag_type{
		width:47%;
		padding:30rpx 0;
		text-align: center;
		border-radius: 20rpx;
		box-shadow: 0 0 15rpx #ddd;
		background-color: #fff;
	}
	.tag_type text{
		margin-top:10rpx;
		color:#555;
	}
	.list_content{
		width:100%;
		margin:20rpx auto;
		// padding:20rpx;
		background-color: #fff;
		// border-radius: 20rpx;
	}
	.con_list{
		padding:20rpx;
	}
	.con_list>image{
		width:25%;
		height:180rpx;
		border-radius: 10rpx;
		vertical-align: top;
	}
	.con_intro{
		width:70%;
		margin-left:15rpx;
		vertical-align: top;
	}
	.person_con{
		margin-top:10rpx;
		font-size: 26rpx;
		color:#666;
	}
	.title_name{
		width:80%;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.price{
		width:70%;
		bottom:50rpx;
		font-size: 28rpx;
	}
	.detail{
		font-size: 26rpx;
		color:#0f848c;
		padding:3rpx 25rpx;
		border:1rpx solid #0f848c;
		border-radius: 18rpx;
	}
	.time{
		font-size: 24rpx;
		color:#666;
	}
</style>